﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AvisoSuporte
{
    public partial class Login : Form
    {
        bool login = false;
        public Login()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if(txtUsuario.Text != string.Empty || txtSenha.Text != string.Empty)
            {
                ((Principal)this.Owner).Usuario = txtUsuario.Text;
                ((Principal)this.Owner).Senha = txtSenha.Text;

                login = true;
                this.Close();
            }
            else
            {
                MessageBox.Show("Digite Usuário e Senha da Rede");
            }
        }

        private void Login_FormClosing(object sender, FormClosingEventArgs e)
        {
            if(!login)
                Application.Exit();
        }

        private void txtSenha_KeyPress(object sender, KeyPressEventArgs e)
        {
            if(e.KeyChar == '\r')
            {
                login = true;
                this.Close();
            }


        }
    }
}
